package com.cgbl.cg.adapter

import android.text.TextUtils
import androidx.appcompat.widget.AppCompatImageView
import com.cgbl.cg.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.robot.base.utils.pic.ImageLoaderUtils

class PhotoAdapter(var addImgRes: Int) : BaseQuickAdapter<String, BaseViewHolder>(R.layout.app_item_photo) {
    override fun convert(holder: BaseViewHolder, item: String) {
        holder.setGone(R.id.item_iv_close, TextUtils.isEmpty(item))
        val ivImg = holder.getView<AppCompatImageView>(R.id.item_iv_img)
        if (TextUtils.isEmpty(item)) {
            ImageLoaderUtils.displayRound(context, ivImg, addImgRes, 8)
        } else {
            ImageLoaderUtils.displayRound(context, ivImg, item, 4)
        }
    }
}